#ifndef JS_ENGINE_H
#define JS_ENGINE_H

#include "jsapi.h"
#include <glib.h>

typedef struct _js_engine js_engine;
struct _js_engine {
    JSRuntime *rt;
    JSContext *cx;
    JSObject *glob;
    JSObject *view;
};

js_engine *js_engine_new(void);
js_engine *js_engine_new_from_runtime(js_engine *engine);
gboolean js_engine_destroy(js_engine *engine);
gboolean js_engine_load_script_file(js_engine *engine, JSObject *obj, const gchar *filename);
gboolean js_engine_load_xml(js_engine *engine, const gchar *xmlFilename);
JSObject *js_engine_get_object(js_engine *engine, const gchar *name);
#endif
